import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import { Observable } from 'rxjs/Rx';

import { ConfigService } from '../../../core/common/config.service';
import { BaseService } from '../../../core/service/base.service';
@Injectable()
export class PasswordService extends BaseService {
  constructor(protected http: Http, protected config: ConfigService) {
    super(http, config);
  }
  public changePassword(oldPassword: string, newPassword: string, account?: string): Observable<any> {
    let url;
    if (account) {
      url = 'service=UserService&method=checkAndUpdateNameAndPwd';
    } else {
      url = 'service=UserService&method=changePwd';
    }
    return super.submit(url, { account: account, oldPwd: oldPassword, newPwd: newPassword });
  }
}
